package com.love.marriage.cloud.service;

import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.love.marriage.cloud.vo.CheckVo;
import com.love.marriage.cloud.vo.RedPacketResultVo;
import com.love.marriage.cloud.vo.RedPacketVo;
import com.love.marriage.cloud.vo.WithdrawVo;
import me.chanjar.weixin.common.error.WxErrorException;
import org.xml.sax.SAXException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.util.List;
import java.util.Map;

public interface WechatService {

    WxPayUnifiedOrderV3Result.JsapiResult unifiedOrder(Long userId, Integer amount, String type, String orderNumber, String desc) throws WxPayException;

    String getToken() throws WxErrorException;

    /**
     * @param openId
     * @param userId
     * @param userCode
     * @param type
     * @description: 发送消息
     * @author: alex
     * @return: boolean
     */
    boolean sentUserMessage(String openId, Long userId, String userCode, String type) throws WxErrorException;

    boolean sentUserSubscribeMessage(String openId, Long userId, String userCode, String type) throws WxErrorException;

    boolean checkSignature(String signature, String timestamp, String nonce);

    Boolean gzhCallBack(HttpServletRequest request) throws ParserConfigurationException, IOException, SAXException, WxErrorException;

    boolean sentUserPartnerMessageInfo() throws WxErrorException;

    Map<String, String> withdrawMoneyToWeChat(WithdrawVo withdrawVo) throws Exception;

    CheckVo secCheck(CheckVo checkVo) throws Exception;

    boolean verifyURL(String signature, String timestamp, String nonce, String echostr, HttpServletResponse response) throws WxErrorException, IOException;

    Boolean cancelWithdrawToWeChat(Long id, String status) throws WxPayException;

    void secCheckCallback(String requestBody, String signature, String timestamp, String nonce, String encryptType, String msgSignature, HttpServletResponse response) throws IOException;

    Map<String, String> getImgResult(List<String> traceIds);

    /**
     * 发送微信红包
     * @param redPacketVo 红包信息
     * @return 红包发送结果
     * @throws Exception 异常信息
     */
    RedPacketResultVo sendRedPacket(RedPacketVo redPacketVo) throws Exception;

    RedPacketResultVo sendMinProgramRedPacket(RedPacketVo redPacketVo) throws Exception;
}
